<template>
  <el-dialog
    top="30px"
    width="1000px"
    append-to-body
    :visible.sync="visible"
    :close-on-click-modal="false"
    :before-close="beforeClose"
  >
    <el-form @submit.native.prevent :inline="true" :model="params">
      <el-form-item>
        <el-input
          v-model="params.customer_name"
          @keyup.enter.native="listGetData"
          placeholder="企业名称/贷款人名称"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-form-item>
          <el-button :loading="loading" icon="el-icon-search" @click="listGetData">查询</el-button>
        </el-form-item>
      </el-form-item>
    </el-form>
    <analy-list ref="analy" :query-params="inQueryParams"></analy-list>
  </el-dialog>
</template>
<script>
import AnalyList from '@/credit/views/city/report/AnalyList'
import { mapGetters } from 'vuex'
export default {
  components: {
    AnalyList,
  },
  props: {
    visible: Boolean,
    bankId: String,
  },
  computed: {
    ...mapGetters(['clientId']),
    inQueryParams() {
      return {
        ...this.queryParams,
        busStatus: 0,
      }
    },
  },
  data() {
    return {
      params: {},
      loading: false,
      queryParams: {
        bankId: '',
        customer_name: '',
        guaType: '1,2,3,4',
      },
    }
  },
  watch: {
    bankId: {
      handler: function () {
        this.queryParams.bankId = this.bankId
      },
      immediate: true,
    },
  },

  created() {},
  methods: {
    listGetData() {
      this.queryParams.customer_name = this.params.customer_name || ''
      this.$refs.analy.getData()
    },
    beforeClose() {
      this.$emit('update:visible', false)
    },
  },
}
</script>
<style lang="scss" scoped></style>
